@SET MAKE_EXEC_FLAG=1
@if not defined PROJECT_ROOT (
    echo please run under buildwnd
    goto :EOF
)

@if not exist %SDK_HOME%\gtest (
    echo not found %SDK_HOME%\gtest
    goto :EOF
)

@pushd %SDK_HOME%

@SET GTEST_HOME=%SDK_HOME%\gtest
@SET GTEST_WIN=%GTEST_HOME%\msvc%MSVC_VERSION%

@SETLOCAL

@SET MSVC_PROJECT_ROOT=%GTEST_WIN%
@SET MSVC_PROJECTS=gtest.sln:gtest
@SET PROJECT_DEBUG=debug
@call make build

@SET PROJECT_DEBUG=release
@call make build

@ENDLOCAL

@if not exist %MSVC_PROJECT_ROOT%\lib mkdir %MSVC_PROJECT_ROOT%\lib
@copy/y %GTEST_WIN%\release\gtest.lib  %MSVC_PROJECT_ROOT%\lib
@copy/y %GTEST_WIN%\debug\gtestd.lib   %MSVC_PROJECT_ROOT%\lib
@xcopy/s/y %GTEST_HOME%\include\*.*    %MSVC_PROJECT_ROOT%\include

@popd
